package com.starblink.android.basic.util.post

import android.content.res.ColorStateList
import android.view.View
import com.starblink.android.basic.databinding.DialogStoreFollowSuccessBinding
import com.starblink.android.basic.ext.click
import com.starblink.android.basic.ext.color
import com.starblink.android.basic.ext.gone
import com.starblink.android.basic.extension.navigation
import com.starblink.android.basic.user.UserDataCenter
import com.starblink.android.basic.widget.dialog.BaseBottomSheetFragment
import com.starblink.basic.route.RoutePage
import com.starblink.basic.util.CommUtils

/**
 * 店铺关注成功弹窗
 */
class StoreFollowSuccessDialog() : BaseBottomSheetFragment() {
    lateinit var viewBinding: DialogStoreFollowSuccessBinding

    override fun getBindingRootView(): View {
        viewBinding = DialogStoreFollowSuccessBinding.inflate(layoutInflater)
        return viewBinding.root
    }

    override fun initView() {
        viewBinding.btnNice.click {
            dismiss()
        }

        if (UserDataCenter.isLogin()) {
            // 已登录不显示登录按钮
            viewBinding.btnNice.strokeWidth = 0
            viewBinding.btnNice.backgroundTintList =
                ColorStateList.valueOf(color(com.starblink.basic.style.R.color.gu_bg_dark2))
            viewBinding.btnNice.setTextColor(CommUtils.getColor(com.starblink.basic.style.R.color.gu_white))
            viewBinding.btnLoginIn.gone()
        } else {
            viewBinding.btnLoginIn.click {
                dismiss()
                navigation(path = RoutePage.Login.SING_IN)
            }
        }
    }
}